package com.audaque.springboot.foshanupload.core.enums;


import com.audaque.springboot.foshanupload.core.inface.DataMaskFunction;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;


/**
 * @author zgb
 * @desc ...
 * @date 2022-11-22 20:14:50
 */
@Getter
@AllArgsConstructor
public enum DataMask {

    /**
     *  实例化枚举对象
     */
    NO_MASK((str, maskChar) -> {
        return str;
    }),
    ALL_MASK((str, maskChar) -> {
        if (StringUtils.isNotBlank(str)) {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < str.length(); i++) {
                sb.append(StringUtils.isNotBlank(maskChar) ? maskChar : DataMaskFunction.MASK_CHAR);
            }
            return sb.toString();
        } else {
            return str;
        }
    });
    //脱密方法接口
    private final DataMaskFunction dataMaskFunction;




}
